package com.action.photo;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.business.photo.PhotoDetailBus;
import com.config.SystemGlobals;

public class UpdatePhoto extends HttpServlet {

	private static final long serialVersionUID = 1L;
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String contentType = SystemGlobals.getValue("contentType");
		PrintWriter out = response.getWriter();
		response.setContentType(contentType);
		String action = request.getParameter("action");
		String photoNo = request.getParameter("no");
		if ("del".equals(action)) {
			PhotoDetailBus pdb = new PhotoDetailBus();
			pdb.del(photoNo);
			out
					.println("<script>alert(\"删除图片成功\");window.location=\"user/photolist.jsp\";</script>");
		}
		if ("edit".equals(action)) {
			RequestDispatcher rd = request
					.getRequestDispatcher("/user/editphoto.jsp?no=" + photoNo);
			rd.forward(request, response);
		}

	}

}
